<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import namespace="InterShopWS" %>
<!--#include file="includes/common.aspx"-->
<!--#include file="includes/includeitems.aspx"-->
<!--#include file="includes/getValue.aspx"-->
<!--#include file="includes/sendMail.aspx"-->
<script  runat="server">
Dim continue="",file=""
Dim strSQL="", No=0,ItemID=""
Dim OrderID=0,CustID=0
Dim amount=0,shipcost=0
Sub Page_Load(ByVal sender As Object, _
	ByVal e As EventArgs)
     continue ="id="  + request.querystring("id")
     continue += "&rows=" + Request.querystring("rows")
     continue += "&pages=" + request.querystring("pages")
     continue +="&page=" + request.querystring("page")
     continue += "&sort=" + request.querystring("sort")
     continue += "&from_=" + request.querystring("from_")	
     file=request.querystring("from_")
    
     if file="" then file="search.aspx"
     if session("shoppingcarts")="" then
	response.redirect("expiry.aspx?" & continue)
     else
	session("shoppingcarts")=session("shoppingcarts")
	session("shoppingcart")=session("shoppingcart")
	session("custinfo")=session("custinfo")
    End if
    Dim i=False
    Dim custtype=""
    Dim ships=""
        Dim pays=""       
        Dim Quantity=0,SalesPrice=0
        Dim discount=0
        Dim email=""
        Dim pwd=""
        Dim fullname= "",	address="",tel=""
        Dim fax="",city="",	province=""
        Dim contact="",times="",register=""
       IF session("isSave")=""  then
	Dim ws As New InterShopWS.MyWSDataSetWS()
  	Dim isOK= _
	ws.getCards( Replace(request.form("txtNo"),"'","''"), _
	Replace(request.form("txtName"),"'","''"), _
	Replace(request.form("txtBinCode"),"'","''"), _
	request.form("txtCM"),request.form("txtCY"), _
	request.form("txtEM"), request.form("txtEY"), _
	"www.intershop.com", request.form("txtAmount"))  
	select case isOK
	case -1:
		msg="Can not Connect BankDatabase."
	case -2:	
		msg="You have not enought money to buy product."
	case -3:
		msg="Can not check your Card."
	case -4:
		msg="Invalid Card No, please enter other CardNo"
	case -5:
		msg="Can not Connect BankDatabase"
	case 1:
		msg="Your Card has been charged."
	case else
		msg="Sorry, unexpected errors."
	end select
       If  isOK >0 Then
         custtype=Seperate(session("custinfo"),"custtype") 
         ships=Seperate(session("custinfo"),"ships") 
         pays=Seperate(session("custinfo"),"pays") 
         amount=Seperate(session("custinfo"),"amount") 
         shipcost=Seperate(session("custinfo"),"shipcost") 
         discount=Seperate(session("custinfo"),"discount")          
         if custtype="new" then
	email=Seperate(session("custinfo"),"email") 
	pwd=Seperate(session("custinfo"),"pwd") 
	fullname= Seperate(session("custinfo"),"fullname") 
	address=Seperate(session("custinfo"),"address") 
	tel=Seperate(session("custinfo"),"tel") 
	fax=Seperate(session("custinfo"),"fax") 
	city=Seperate(session("custinfo"),"city") 
	province=Seperate(session("custinfo"),"province") 
	contact=Seperate(session("custinfo"),"ontact") 
	times=Seperate(session("custinfo"),"times") 
	register=Seperate(session("custinfo"),"register") 
	If register="Yes" then
	  strSQL="sp_newcustorders 0,'" & email
	  strSQL += "','" + pwd + "','"
	  strSQL += fullname & "','" 
	  strSQL += address & "','" 
	  strSQL += tel & "','" & fax
	  strSQL += "','" & city & "','"
	  strSQL += province & "','"
	  strSQL += contact & "','"
	  strSQL += times & "','"
	  strSQL += ships & "','"
	  strSQL += pays & "','"
	  strSQL += amount & "','"
	  strSQL += shipcost & "','"
	  strSQL += discount & "'"
	Else
	  strSQL="sp_newcustorders 1,'" & email
	  strSQL += "','','" & fullname & "','" 
	  strSQL += address & "','" 
	  strSQL += tel & "','" & fax
	  strSQL += "','" & city & "','"
	  strSQL += province & "','"
	  strSQL += contact & "','"
	  strSQL += times & "','"
	  strSQL += ships & "','"
	  strSQL += pays & "','"
	  strSQL += amount & "','"
	  strSQL += shipcost & "','"
	  strSQL += discount & "'"
	End if
           Else
	CustID=Seperate(session("custinfo"),"id") 
	strSQL="sp_oldcustorders '" & CustID & "','"
	strSQL += ships & "','"
	strSQL += pays & "','"
	strSQL += amount & "','"
	strSQL += shipcost & "','"
	strSQL += discount & "'"
           End if
           'response.write(strSQL)
           'OrderID=ReturnNo(strSQL)
          ' response.write(OrderID)
           strSQL=""
           if OrderID > 0 then
	For No = 1 to session("shoppingcart")	
	   If custtype="old" or register="Yes" then
		strSQL="exec sp_orderdetails 0," 
	   Else
		strSQL="exec sp_orderdetails 1," 
	   End if
		strSQL += "'" & OrderID & "',"
		strSQL += "'" & No & "',"
 		ItemID=Seperate(session("shoppingcarts"), No & "itemid") 
		strSQL += "'" & ItemID & "',"
		Quantity=Seperate(session("shoppingcarts"),"itemqtty" & No)
		strSQL += "'" & Quantity & "',"
		SalesPrice=Seperate(session("shoppingcarts"),"itemprice" & No)  	
		strSQL += "'" & SalesPrice & "',"
		Discount=Seperate(session("shoppingcarts"),"itemdiscount" & No) 
		strSQL += "'" & Discount & "',"
		Amount=Quantity* SalesPrice
		strSQL += "'" & Amount & "'"
		'response.write(strSQL & "<br>")
		'Dim i=doSQL(strSQL)
	Next
        End if
        Dim subject="Your ONLINE-ORDER has been "
        subject +="successfully added to our "
	Dim body="database!<div align=justify>Thank you "
	body += "for purchasing. Products in the "
	body += "InterShop.com site. <P>The "
	body += "total cost for your package is <b>"
	body += formatnumber(cdbl(amount)+ cdbl(shipcost))
	body += "</b>. An invoice has been sent "
	body += "to your e-mail address.<br><br>"
	body += "<b>Your  package will be sent to "
	body += "you until after we have received "
	body += "confirmation from BANK.</b> "
	body += "<br><br> <br><br>Please call "
	body += "(848) 898 2680 with any questions."
	body += "  All prices are exclusive of VAT.<p>"
	body += "Thank you for using InterShop.com!<p>"
	'i=SendMail("admin@intershopmail.com",email,"","",subject,body)
         'session("isSave")="Y"
    End If    
  End If
End Sub
</script>

<HTML><HEAD><TITLE>InterShop-Online Shopping</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<META content=""  name=description>
<META content="trading software platform" name=keywords>
<META http-equiv=Pragma content=no-cache>
<LINK href="style.css" type=text/css rel=stylesheet>
<SCRIPT language=JavaScript>
        	self.defaultStatus = "Online-Shopping!";                           
</SCRIPT>
</HEAD>
<BODY bottomMargin=0 leftMargin=0 topMargin=0  rightMargin=0 marginheight="0"  marginwidth="0">
<!--#include file="top.aspx"-->
<TABLE cellSpacing=0 cellPadding=0 border=0  width="775" >
  <TBODY> 
  <TR>
    <TD vAlign=top align="center" width="160"> 
      <table width="18%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="center"><br> 
            <table border=0 cellspacing=0 cellpadding=0>
              <tr valign=bottom align=center> 
                <td><img src="images/new-products.gif" height="19" width="155"></td>
              </tr>
              <tr valign=top align=center> 
                <td> 
                  <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                    <tr> 
                      <td width=100% height="49"> 
                        <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                          <tr> 
                            <td valign=top width=8% align="left" height="51" bgcolor="#EEEECC"> 
                              <table cellspacing=0 cellpadding=0 border=0  width="100%">
                                <tr> 
                                  <td colspan=2>&nbsp;</td>
                                </tr>
                                <tbody> 
                                <tr  align="left"> 
                                  <td colspan=2> 
                                    <input size=15  onFocus="this.value = '';" value="Keyword" name=txtKeyword class=textbox>
                                  </td>
                                </tr>
                                <tr> 
                                  <td align=left> 
                                    <select name="cbCate">
                                      <option selected>All Products</option>
                                      <option>Books</option>
                                      <option>Poems</option>
                                    </select>
                                    <img height=21 
            alt="Click here to search the Item." 
            src="images/go.gif" 
            width=21 align=absMiddle 
      border=0></td>
                                </tr>
                                </tbody> 
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
            </table>
      </table>
	  <table width="18%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="center"><br> 
            <table border=0 cellspacing=0 cellpadding=0>
              <tr valign=bottom align=center> 
                <td><img src="images/new-products.gif" height="19" width="155"></td>
              </tr>
              <tr valign=top align=center> 
                <td> 
                  <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                    <tr> 
                      <td width=100% > 
                        <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                          <tr> 
                            <td valign=top width=8% align="left" bgcolor="#CAE2F0"> 
                              <input size=15  onFocus="this.value = '';" value="Keyword" name=txtKeyword2 class=textbox>
                              <img height=21 
            alt="Click here to search the Item." 
            src="images/go-button.gif" 
            width=21 align=absMiddle 
      border=0> <br>
                              <img src="images/powered-by-google.gif" width="95" height="14"> 
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
            </table>
      </table>
       <table width="18%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="center"><br> 
            <table border=0 cellspacing=0 cellpadding=0>
              <tr valign=bottom align=center> 
                <td><img src="images/browse-items.gif" width="155" height="19"></td>
              </tr>
              <tr valign=top align=center> 
                <td> 
                  <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                    <tr> 
                      <td width=100% height="49"> 
                        <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                          <tr> 
                            <td valign=top width=8% align="left" height="51" bgcolor="#CAE2F0">
							 <!--#include file="includes/listsubcategories.htm"-->
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
            </table>
      </table>
      <!--#include file="left.aspx"-->
    </TD>
    <TD class=margin width="1" valign="top" align="right" bgcolor="#666666" > 
    </TD>
    <TD class=text_normal id=mainContent vAlign=top width="420"> 
      <TABLE cellSpacing=4 cellPadding=4 width="100%" align=left border=0 height="61">
        <TR> 
          <TD vAlign=top align=left height="46"> 
            <!--#include file="submenu.aspx"-->
	<br><img src="images/thankyou.gif">
             </TD>
        </TR>
        <TBODY> 
        <TR> 
          <TD vAlign=top align=left>
<% IF session("isSave")<>"Y" Then%>
	<h3>Your ONLINE-ORDER has been successfully added to our database!</h3>
	<div align="justify">
	Thank you for purchasing Products in the InterShop.com site. 
  <P>The total cost for your package is <b><%=formatnumber(cdbl(amount)+cdbl(shipcost))%></b>. 
An invoice has been sent to your e-mail address.<br><br>
<b>Your  package will be sent to you until after we have received confirmation from BANK.</b><br><br> 
<br><br>Please call (848) 898 2680 with any questions.  
All prices are exclusive of VAT.
<p>
Thank you for using InterShop.com.com!<p>You can view your orders <a href="myaccount.aspx?<%=continue%>">here</a>.<br><Br>

</div>
<%if session("isSave")="Y"%>
<h3>Your ONLINE-ORDER has been successfully added to our database!</h3>
<%END IF%>
<br><br> 
<div align=center><a href="<%=file & "?" & continue%>"><img src="images/search.gif" border=0></a></div>
          </TD>
        </TR>
        </TBODY> 
      </TABLE>
    </TD>
    <TD class=margin width="1" valign="top" align="right" bgcolor="#666666" > 
    </TD>
    <TD class=margin valign="top" align="left" width="160"> 
      <TABLE>
        
        <tr> 
          <td>&nbsp;</td>
          <td valign=top> 
            <!--#include file="includes/right-next.htm" -->
          </td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td valign="top"><br>
            <table width="18%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td align="center"> 
                  <table border=0 cellspacing=0 cellpadding=0>
                    <tr valign=bottom align=center> 
                      <td><img src="images/new-products.gif" width="155" height="19"></td>
                    </tr>
                    <tr valign=top align=center> 
                      <td> 
                        <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                          <tr> 
                            <td width=100%> 
                              <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                                <tr> 
                                  <td valign=top width=8% align="left" height="52"> 
                                    <p>&nbsp;</p>
                                  </td>
                                  <td valign=top width=92% align="left" height="52"> 
                                    <!--#include file="includes/right-top.htm" -->
                                  </td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                  </table>
            </table>
          </td>
        </tr>        
      </TABLE>
    </TD>
  </TR></TBODY></TABLE>
  <!--#include file="bottom.aspx"-->
</BODY></HTML>
